package com.webank.webase.chain.mgr.repository.bean;

import java.io.Serializable;
import java.util.Date;
import com.webank.webase.chain.mgr.base.enums.ChainStatusEnum;
import com.webank.webase.chain.mgr.base.enums.DeployTypeEnum;
import com.webank.webase.chain.mgr.base.enums.EncryptTypeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@ToString
@NoArgsConstructor
@EqualsAndHashCode
public class TbChain implements Serializable {

    public static TbChain init(int chainId, String chainName, String description, String version, String consensusType, String storageType, EncryptTypeEnum encryptTypeEnum, ChainStatusEnum status, DeployTypeEnum deployTypeEnum) {
        Date now = new Date();
        TbChain chain = new TbChain();
        chain.setChainId(chainId);
        chain.setChainName(chainName);
        chain.setChainType((byte) encryptTypeEnum.getType());
        chain.setDescription(description);
        chain.setVersion(version);
        chain.setConsensusType(consensusType);
        chain.setStorageType(storageType);
        chain.setChainStatus(status.getId());
        chain.setWebaseSignAddr("");
        chain.setCreateTime(now);
        chain.setModifyTime(now);
        chain.setDeployType(deployTypeEnum.getType());
        chain.setRemark("");
        return chain;
    }

    private int progress;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.chain_id
     *
     * @mbg.generated
     */
    private Integer chainId;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.chain_name
     *
     * @mbg.generated
     */
    private String chainName;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.chain_type
     *
     * @mbg.generated
     */
    private Byte chainType;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.description
     *
     * @mbg.generated
     */
    private String description;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.create_time
     *
     * @mbg.generated
     */
    private Date createTime;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.modify_time
     *
     * @mbg.generated
     */
    private Date modifyTime;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.version
     *
     * @mbg.generated
     */
    private String version;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.consensus_type
     *
     * @mbg.generated
     */
    private String consensusType;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.storage_type
     *
     * @mbg.generated
     */
    private String storageType;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.chain_status
     *
     * @mbg.generated
     */
    private Byte chainStatus;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.webase_sign_addr
     *
     * @mbg.generated
     */
    private String webaseSignAddr;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.deploy_type
     *
     * @mbg.generated
     */
    private Byte deployType;

    /**
     *
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column tb_chain.remark
     *
     * @mbg.generated
     */
    private String remark;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table tb_chain
     *
     * @mbg.generated
     */
    private static final long serialVersionUID = 1L;
}
